package csxXiti.xiti2;

/**
 * @author WuYongheng
 * @date 2021/11/24
 * @description
 */
public class xiti2_4 {
        public static void main(String[] args) {
            Book book = new Book();
            book.bookname="java编程";
            book.price=20;
            book.number=1000;
            book.count=0;
            book.display();
            book.borrow();
            book.restore();
        }
    }
    class Book{
        //属性
        String bookname;
        int price;
        int number;
        int count;
        //方法
        public void display(){
            System.out.println("书名："+bookname+"价格："+price);
            System.out.println("存书数量："+number+"借阅次数："+count);
        }
        public void borrow(){
            this.number--;
            this.count++;
            System.out.println("存书数量："+number);
            System.out.println("借阅次数："+count);
        }
        public void restore(){
            this.number++;
            System.out.println("存书数量："+number);
        }
    }

